package TOP_Version1;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

public class Top_JDBC_Connection {
	
	public static Connection openDataBase() {
		Connection conn = null;
		try {
			Class.forName( Top_JDBC_Info.DRV );
			conn = DriverManager.getConnection( Top_JDBC_Info.URL );
		} catch ( ClassNotFoundException e ) {
			e.printStackTrace();
		} catch ( Exception e ) {
			e.printStackTrace();
		}
		return conn;
	}

	public static void closeDataBase( Connection c, PreparedStatement p, ResultSet r ) {
		if ( r != null ) try { r.close(); r = null; } catch ( Exception e ) { }
		if ( p != null ) try { p.close(); p = null; } catch ( Exception e ) { }
		if ( c != null ) try { c.close(); c = null; } catch ( Exception e ) { }
	}
	
	
}
